public class test1 {
    //力扣 495.提莫攻击
    public int findPoisonedDuration(int[] t, int duration) {
        int ret = 0;
        for(int i = 0;i<t.length-1;i++){
            if((t[i+1]-t[i])>=duration){
                ret+=duration;
            }else{
                ret+=t[i+1]-t[i];
            }
        }
        return ret+duration;
    }
}
